feat(mcp-oauth): support static clientId for servers without DCR#379
feat(mcp-oauth): support static clientId for servers without DCR#379proyectoauraorg wants to merge 5 commits into
Conversation
…provider Merging 12 new test cases covering completePrompt, streaming resilience, and edge cases.
Dependabot bump. Compatible: project requires node>=20.20.2, uuid v14 requires node>=20.
Add optional oauth.clientId field to MCP server configuration schema. When provided, the OAuth provider uses this clientId directly instead of performing Dynamic Client Registration (DCR). This enables connections to OAuth-protected MCP servers that don't support RFC 7591 DCR. Changes: - BaseConfigSchema: add oauth.clientId optional field - McpOAuthClientProvider: accept clientId in create() options, use it in registerClientIfNeeded() to skip DCR - McpHub: pass oauth.clientId from config to the provider - Tests: 2 new tests covering static clientId and precedence over cache Aligned with VS Code 1.122 feature: MCP OAuth with custom clientId.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds optional static OAuth ChangesStatic OAuth clientId Configuration
Stream tests and dependency bump
Sequence Diagram(s)sequenceDiagram
participant McpHub
participant McpOAuthClientProvider
participant registerClientIfNeeded
participant SecretStorage
participant DCR
McpHub->>McpOAuthClientProvider: create(..., { clientId })
McpOAuthClientProvider->>McpOAuthClientProvider: store _staticClientId
McpOAuthClientProvider->>registerClientIfNeeded: registerClientIfNeeded()
registerClientIfNeeded->>registerClientIfNeeded: check _staticClientId
alt static clientId present
registerClientIfNeeded->>McpOAuthClientProvider: set _clientInfo {client_id, redirectUrl}
registerClientIfNeeded-->>McpOAuthClientProvider: return
else no static clientId
registerClientIfNeeded->>SecretStorage: get cached client_info
alt cached
SecretStorage-->>registerClientIfNeeded: client_info
else
registerClientIfNeeded->>DCR: perform dynamic client registration
DCR-->>registerClientIfNeeded: client_info
end
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
src/api/providers/__tests__/mimo.spec.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Wouldn't this also require a secret? This would also require the whole normal OAuth 2.0 flow to be available when provided. This is larger than a 3 file change. |
# Conflicts: # pnpm-lock.yaml
|
Thanks for the contribution. There is also the huge readme file that was committed like your other PRs, we should remove it. |
Related GitHub Issue
Aligned with VS Code 1.122 feature #257415 — MCP OAuth with custom clientId.
Description
Adds optional
oauth.clientIdfield to MCP server configuration. When provided, the OAuth provider uses this clientId directly instead of performing Dynamic Client Registration (DCR). This enables connections to OAuth-protected MCP servers that don't support RFC 7591 DCR.Use case: Many corporate and self-hosted MCP servers require a pre-registered clientId but don't support DCR. Currently, Zoo Code cannot connect to these servers via OAuth.
Changes:
BaseConfigSchema: addoauth.clientIdoptional fieldMcpOAuthClientProvider: acceptclientIdincreate()options, use it inregisterClientIfNeeded()to skip DCRMcpHub: passoauth.clientIdfrom config to the providerExample configuration in
.roo/mcp.json:{ "mcpServers": { "corporate-server": { "type": "streamable-http", "url": "https://mcp.corporate.example.com", "oauth": { "clientId": "my-app-id-12345" } } } }Test Procedure
Unit tests (104 passed):
McpOAuthClientProvider.spec.ts— 44 tests (42 existing + 2 new for static clientId)McpHub.spec.ts— 60 tests (all existing, schema change verified)New tests:
should use static clientId instead of performing DCR— verifies clientId is used directlyshould use static clientId even when cached data exists— verifies static takes precedence over cached DCRPre-Submission Checklist
Documentation Updates
Summary by CodeRabbit
New Features
Tests
Chores